<template>
    <ul class="control center" @click.stop>
        <li v-if="index>0"><i class="el-icon-top" @click="arrSwap(index,'up')"></i></li>
        <li v-if="index<diyModule.length-1"><i class="el-icon-bottom" @click="arrSwap(index,'down')"></i></li>
        <li><i class="iconfont iconshanchu" @click="arrSwap(index,'delete')"></i></li>
    </ul>
</template>

<script>
import { mapState } from 'vuex'
export default {
    props:{
        index:{
            type: [String,Number]
        }
    },
    computed:{
		...mapState(['diyModule'])
    },
    methods: {
        // 切换数组位置
        arrSwap(index,type){
            this.$store.commit('toggleAttr', false)
            this.$store.commit('moduleSwap',{index,type})
        },
    },
}
</script>


